<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<ol>
    <li>webWorker子线程排队需要等到主线程中的其他子线程排队完毕</li>
</ol>
<script>
    const worker = new Worker('childThread.js');

    setTimeout(() => {
        console.log('timeout parent');
    }, 0);

    console.log('parent');

    worker.onmessage = (val) => {
        const { data } = val;
        console.log('这是childThread传递过来的参数', data, val);
    }

    worker.postMessage('hello childThread');
</script>
</body>
</html>